#pragma once
#include <zCoreConfig.hpp>

#ifdef ZZZ_LIB_PTHREAD
#include <pthread.h>

namespace zzz{
class ZCORE_CLASS Thread {
public:
  Thread();
  void Start();
  void Wait();

  bool IsRunning();
  virtual void Main()=0;

  pthread_t thread;
  bool running;
};

class ZCORE_CLASS Mutex {
public:
  Mutex();
  ~Mutex();
  void Lock();
  void Unlock();
  bool TryLock();
  pthread_mutex_t mutex; 
};

class ZCORE_CLASS Condition {
public:
  Condition();
  ~Condition();
  virtual bool IsSatisfied()=0;
  void Check();
  void Wait();

  pthread_mutex_t mutex;
  pthread_cond_t cond;
};
}
#endif // ZZZ_LIB_PTHREAD
